//
//  FKOrderDetailAddressCell.m
//  WanTao
//
//  Created by Macbook Pro on 2019/4/12.
//  Copyright © 2019 Macbook Pro. All rights reserved.
//

#import "FKOrderDetailAddressCell.h"
#import "FKOrder.h"

@interface FKOrderDetailAddressCell ()

@property (nonatomic, weak) UILabel *nameLabel;
@property (nonatomic, weak) UILabel *mobileLabel;
@property (nonatomic, weak) UILabel *addressLabel;

@end

@implementation FKOrderDetailAddressCell

- (void)setupSubviews
{
    [super setupSubviews];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    UIImageView *iconView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"address_location"]];
    [self.contentView addSubview:iconView];
    
    UILabel *nameLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor333333];
    [self.contentView addSubview:nameLabel];
    self.nameLabel = nameLabel;
    
    UILabel *mobileLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor333333];
    [self.contentView addSubview:mobileLabel];
    self.mobileLabel = mobileLabel;
    
    UILabel *addressLabel = [UILabel fk_labelWithFont:fk_adjustFont(14) textColor:fkColor333333];
    [self.contentView addSubview:addressLabel];
    self.addressLabel = addressLabel;
    addressLabel.numberOfLines = 2;
    
    [iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(12);
        make.centerY.offset(0);
        make.width.offset(13.5);
        make.height.offset(18.5);
    }];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(iconView.mas_right).offset(8);
        make.top.offset(fk_adjustW(15));
    }];
    [mobileLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset(-12);
        make.centerY.equalTo(nameLabel);
    }];
    [addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(nameLabel);
        make.right.equalTo(mobileLabel);
        make.bottom.offset(fk_adjustW(-10));
    }];
}

- (void)setData:(id)data
{
    [super setData:data];
    
    if ([data isKindOfClass:[FKOrder class]]) {
        FKOrder *model = data;
        self.nameLabel.text = model.user_name;
        self.mobileLabel.text = model.mobile;
        self.addressLabel.text = model.region;
    }
}


@end
